From: Benjamin Otte Date: Mon, 13 Jun 2011 04:13:16 +0000 (+0200) Subject: themingengine: Improve handling of different colors X-Git-Tag: archive/raspbian/3.24.39-1+rpi1~1^2~65^2~39^2~21032 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=a471b4b19848178c8cc2d1d84ca1be25bc63d170;p=gtk%2B3.0.git themingengine: Improve handling of different colors We don't want to have different colors cause seams, so we try very hard to render them at the same time. --- diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c index a779125571..b43bda7d8c 100644 --- a/gtk/gtkthemingengine.c +++ b/gtk/gtkthemingengine.c @@ -1665,7 +1665,7 @@ render_frame_internal (GtkThemingEngine *engine, GtkBorder border; static const guint current_side[4] = { SIDE_TOP, SIDE_RIGHT, SIDE_BOTTOM, SIDE_LEFT }; GdkRGBA *colors[4]; - guint i; + guint i, j; state = gtk_theming_engine_get_state (engine); @@ -1763,16 +1763,33 @@ render_frame_internal (GtkThemingEngine *engine, if (hidden_side & current_side[i]) continue; - gdk_cairo_set_source_rgba (cr, colors[i]); + for (j = 0; j < 4; j++) + { + if (hidden_side & current_side[j]) + continue; + + if (i == j || + gdk_rgba_equal (colors[i], colors[j])) + { + /* We were already painted when i == j */ + if (i > j) + break; + + if (j == 0) + _gtk_rounded_box_path_top (&border_box, &padding_box, cr); + else if (j == 1) + _gtk_rounded_box_path_right (&border_box, &padding_box, cr); + else if (j == 2) + _gtk_rounded_box_path_bottom (&border_box, &padding_box, cr); + else if (j == 3) + _gtk_rounded_box_path_left (&border_box, &padding_box, cr); + } + } + /* We were already painted when i == j */ + if (i > j) + continue; - if (i == 0) - _gtk_rounded_box_path_top (&border_box, &padding_box, cr); - else if (i == 1) - _gtk_rounded_box_path_right (&border_box, &padding_box, cr); - else if (i == 2) - _gtk_rounded_box_path_bottom (&border_box, &padding_box, cr); - else if (i == 3) - _gtk_rounded_box_path_left (&border_box, &padding_box, cr); + gdk_cairo_set_source_rgba (cr, colors[i]); cairo_fill (cr); }